﻿using System;
using System.ComponentModel;
using System.Linq;
using Inaction.Core;
using Inaction.Mapping;
using System.ComponentModel.DataAnnotations;

namespace Inaction.Business.Security
{
    [Table("Department"), DisplayName("部门"), Serializable]
    public class Department : Abstract.Department<Department>
    {
        #region 子表

        [Display(Description = "部门"), DisplayName("部门")]
        public DepartmentList Departments
        {
            get { return GetChild<DepartmentList, Department>(); }
        }

        [Display(Description = "用户"), DisplayName("用户")]
        public UserInfoList UserInfos
        {
            get { return GetChild<UserInfoList, UserInfo>(); }
        }

        #endregion

        static Department()
        {
            AddChildRelationship<Department>(ParentDepartmentIdProperty);
        }
    }

    [DisplayName("部门列表"), Serializable]
    public class DepartmentList : Inaction.Business.EntityList<DepartmentList, Department>
    {
    }
}
